package com.lagou.wwyan.dubbo;

import com.lagou.wwyan.dubbo.component.HelloComponent;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource("classpath:/dubbo-consumer.properties")
//@EnableDubbo(scanBasePackages = "com.lagou.bean")
@ComponentScan("com.lagou.wwyan.dubbo")
@EnableDubbo
public class DubboConsumerMain {
    public static void main(String[] args) throws Exception {
        AnnotationConfigApplicationContext app = new AnnotationConfigApplicationContext(DubboConsumerMain.class);
        app.start();
        HelloComponent helloComponent = app.getBean(HelloComponent.class);
        while (true){
            for (int i = 0; i < 2000; i++) {
                helloComponent.sayHello();
                Thread.sleep(3);

            }
//            Thread.sleep(6000);
        }
    }
}
